home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / demos / VisualAge for Java 2.0 Entry / setup / data1.cab / ide-e / IDE / cache / RZ44CJ (.txt) < prev    next >
Encoding:
Java Class File  |  1998-09-16  |  1.2 KB  |  33 lines

  1. package com.sun.java.swing.plaf.basic;
  2.  
  3. import com.sun.java.swing.AbstractButton;
  4. import com.sun.java.swing.JToolBar;
  5. import com.sun.java.swing.border.AbstractBorder;
  6. import com.sun.java.swing.border.Border;
  7. import com.sun.java.swing.text.JTextComponent;
  8. import java.awt.Component;
  9. import java.awt.Insets;
  10.  
  11. public class BasicMarginBorder extends AbstractBorder {
  12.    private static Border marginBorder = new BasicMarginBorder();
  13.  
  14.    public Insets getBorderInsets(Component c) {
  15.       if (c instanceof AbstractButton) {
  16.          AbstractButton b = (AbstractButton)c;
  17.          return b.getMargin();
  18.       } else if (c instanceof JToolBar) {
  19.          JToolBar t = (JToolBar)c;
  20.          return t.getMargin();
  21.       } else if (c instanceof JTextComponent) {
  22.          JTextComponent t = (JTextComponent)c;
  23.          return t.getMargin();
  24.       } else {
  25.          return new Insets(0, 0, 0, 0);
  26.       }
  27.    }
  28.  
  29.    public static Border getMarginBorder() {
  30.       return marginBorder;
  31.    }
  32. }
  33.